package com.hccl.mongoEntities;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.hccl.mongoEntities.step.StepTransition;
import org.bson.types.ObjectId;
import org.mongodb.morphia.annotations.Embedded;
import org.mongodb.morphia.annotations.Entity;
import org.mongodb.morphia.annotations.Id;
import org.mongodb.morphia.annotations.Reference;

import java.util.ArrayList;
import java.util.List;

/**
 * 配置文件中JsonCommand实体，主要是定义能接受的命令的名字以及该命令下的跳转条件和动作
 */
@Entity(value = "commands", noClassnameStored = true)
public class CommandEntity {

    @Id
    @JsonIgnore
    protected ObjectId id;
    String name;
    List<StepTransition> transitions = new ArrayList<>();
    @Reference(idOnly=true,lazy=true)
    @JsonIgnore
    protected List<GrammarRuleEntity> rules = new ArrayList<GrammarRuleEntity>();
    @JsonIgnore
    protected List<String> corpus = new ArrayList<String>();
    @JsonIgnore
    protected boolean ordered;

    public boolean isOrdered() {
        return ordered;
    }

    public void setOrdered(boolean ordered) {
        this.ordered = ordered;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public List<StepTransition> getTransitions() {
        return transitions;
    }

    public void setTransitions(List<StepTransition> transitions) {
        this.transitions = transitions;
    }

//    public List<RuleEntryEntity> getLists() {
//        return lists;
//    }
//
//    public void setLists(List<RuleEntryEntity> lists) {
//        this.lists = lists;
//    }

    public ObjectId getId() {
        return id;
    }

    public void setId(ObjectId id) {
        this.id = id;
    }

    public List<GrammarRuleEntity> getRules() {
        return rules;
    }

    public void setRules(List<GrammarRuleEntity> rules) {
        this.rules = rules;
    }

    public List<String> getCorpus() {
        return corpus;
    }

    public void setCorpus(List<String> corpus) {
        this.corpus = corpus;
    }
}
